using Microsoft.Practices.Unity;
using ProjectFootball.MVC.Models.RepositoryProviders;
using System.Web.Mvc;
using Unity.Mvc4;

namespace ProjectFootball.MVC
{
  public static class Bootstrapper
  {
    public static IUnityContainer Initialise()
    {
        var container = BuildUnityContainer();
        DependencyResolver.SetResolver(new UnityDependencyResolver(container));

        return container;
    }

    private static IUnityContainer BuildUnityContainer()
    {
        var container = new UnityContainer();
        RegisterTypes(container);
        
        return container;
    }

    public static void RegisterTypes(IUnityContainer container)
    {
        container.RegisterType<IRepositoryProvider, RepositoryProvider>();
    }
  }
}